import { Meteor } from 'meteor/meteor';
import { render } from 'react-dom';
import React from 'react';

import ApolloClient from 'apollo-client';
import { meteorClientConfig } from 'meteor/apollo';
import { ApolloProvider } from 'react-apollo';
import { Router, Route, Link, browserHistory } from 'react-router'
import Home from '/imports/ui/home/Home';

import injectTapEventPlugin from 'react-tap-event-plugin';
injectTapEventPlugin();
import { addLocaleData, IntlProvider } from 'react-intl';
import { en, ru, zh } from 'react-intl/locale-data';
[en, ru, zh].forEach(addLocaleData);

const client = new ApolloClient(meteorClientConfig());
global.locale = navigator.language;


Meteor.startup(() => {
  render(
    <IntlProvider  locale={locale} >
      <ApolloProvider client={client}>
        <Router history={browserHistory}>
          <Route path="/" component={Home}>
          </Route>
        </Router>
      </ApolloProvider>
   </IntlProvider>,
    document.getElementById('app')
  );
});
